package com.sleepcamel.resteasyConfigurator.view.detail;

import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.swt.widgets.Composite;

abstract public class DetailView<T> extends Composite {
	protected DataBindingContext m_bindingContext;

	public DetailView(Composite parent, int style) {
		super(parent, style);
	}

	protected T modelData;
	
	public T getModelData(){
		return modelData;
	}
	
	@Override
	protected void checkSubclass() {
	}
	
	public void setModelData(T data){
		this.modelData = (T) data;
		m_bindingContext = initDataBindings();
	}
	
	protected DataBindingContext initDataBindings() {
		if ( m_bindingContext == null ){
			m_bindingContext = new DataBindingContext();
		}
		return m_bindingContext;
	}
}
